<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
    <title>test</title>
    <script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<form id="uploadForm" method="post" enctype="multipart/form-data">
    用户名：<input name="userName" type="text"/>
    密码：<input name="password" type="password"/>
    文件：<input name="file" type="file"/>
    <input type="button" onclick="subFile()" value="提交">
</form>
<input id="url" type="text" readonly style="width: 500px"/>
</body>
<script type="text/javascript">
    function subFile() {
        var formData = new FormData($("#uploadForm")[0]);
        console.log(formData)
        $.ajax({
            method:"POST",
            url:"/api/common/v1/upload",
            contentType: false,
            processData: false,
            data:formData,
            success:function (result) {
                debugger
                if(result.code===500){
                    alert(result.message);
                }
                else if(result.code===200){
                    $("#url").val(result.result.url) ;
                }

            },
            error:function (msg) {

            }
        })
    }
</script>
</html>